package com.zhubayi.service.impl;

import com.zhubayi.entity.Favor;
import com.zhubayi.mapper.FavorMapper;
import com.zhubayi.service.FavorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 祝八一
 */
@Service
public class FavorServiceImpl implements FavorService {
    @Autowired
    FavorMapper favorMapper;
    @Override
    public void add(Favor favor) {
        favorMapper.add(favor);
    }

    @Override
    public boolean isRepeat(Integer VideoId, Integer UserId) {
        Favor favor = favorMapper.queryByUidVid(VideoId, UserId);
        if (favor==null){
            return false;
        }
        return true;
    }

    @Override
    public Integer queryCountByUid(Integer id) {
        return favorMapper.queryCountByUid(id);
    }

    @Override
    public void deleteByUId(Integer uid, Integer vid) {
        favorMapper.deleteByUId(uid,vid);
    }
}
